DatePicker MergeStyles step 2 - Converts scss to js styles#5362
DatePicker MergeStyles step 2 - Converts scss to js styles#5362lorejoh12 merged 14 commits intomicrosoft:masterfrom
Conversation
…c-react into datepicker-mergestyles-step-2
…c-react into datepicker-mergestyles-step-2
| } | ||
| } | ||
| }, | ||
| className |
There was a problem hiding this comment.
Shouldn't className only be on root? I don't see it mixed in with other class names in old code
There was a problem hiding this comment.
Yes, the standard className prop is a custom class name just for the root, not all elements.
| aria-hidden={true} | ||
| className= | ||
| ms-DatePicker-event--without-label | ||
|
|
There was a problem hiding this comment.
Hmm, I feel like this className should still be here but I don't see any obvious issues with the code
| className="ms-TextField" | ||
| className= | ||
| ms-TextField | ||
| ms-TextField |
There was a problem hiding this comment.
That's odd, I wonder why ms-TextField appears twice?
There was a problem hiding this comment.
coming from TextField root, see my comment in DatePicker.styles.ts for the fix
| } | ||
| &:not(.msDatePickerDisabled) { | ||
| cursor: pointer; | ||
| pointer-events: initial; |
There was a problem hiding this comment.
Do all of these styling changes match up with the new JS styling?
| prevYearAriaLabel: 'Go to previous year', | ||
| nextYearAriaLabel: 'Go to next year' | ||
| }; | ||
|
|
There was a problem hiding this comment.
Nitpicky as all hell I realize, but can you put this blank line before the back? Separating declarations like the class and this interface really help with scan-ability
| @@ -184,8 +196,7 @@ export class DatePickerBase extends BaseComponent<IDatePickerProps, IDatePickerS | |||
| onClick: this._onIconClick, | |||
| className: css( | |||
There was a problem hiding this comment.
This concatination logic should be in the styles.ts file. There css() function should no longer be used.
| IDatePickerStyleProps, | ||
| IDatePickerStyles | ||
| } from './DatePicker.types'; | ||
| import { BaseComponent, KeyCodes, createRef, css, classNamesFunction } from '../../Utilities'; |
There was a problem hiding this comment.
css import should be removed - there's a completely redundant call on line 213 that shouldn't have been there in the first place (its 'concatenating' just one class with nothing else
| } | ||
| } | ||
| }, | ||
| className |
There was a problem hiding this comment.
Yes, the standard className prop is a custom class name just for the root, not all elements.
| const { className } = props; | ||
| const GlobalClassNames = { | ||
| root: 'ms-DatePicker', | ||
| textField: 'ms-TextField', |
There was a problem hiding this comment.
duplicate - 'ms-TextField' comes from the TextField component root, so when they combine you render two 'ms-TextField' s - the scss implementation didn't have a class for this element just styles.
There was a problem hiding this comment.
Yeah, this className should be removed
| exports[`DatePicker renders default DatePicker correctly 1`] = ` | ||
| <div | ||
| className="ms-DatePicker" | ||
| className={undefined} |
There was a problem hiding this comment.
this should not be undefined
There was a problem hiding this comment.
Per our Teams chat, DatePicker.test.tsx snapshot test should be modified to use DatePicker instead of DatePickerBase.
| className="ms-TextField" | ||
| className= | ||
| ms-TextField | ||
| ms-TextField |
There was a problem hiding this comment.
coming from TextField root, see my comment in DatePicker.styles.ts for the fix
| import { TextField, ITextField } from '../../TextField'; | ||
| import { BaseComponent, KeyCodes, css, createRef } from '../../Utilities'; | ||
| import { compareDates, compareDatePart } from '../../utilities/dateMath/DateMath'; | ||
| import * as stylesImport from './DatePicker.scss'; |
There was a problem hiding this comment.
I'm surprised stylesImport isn't causing an error since the file appears to have been removed
| import { compareDates, compareDatePart } from '../../utilities/dateMath/DateMath'; | ||
| import * as stylesImport from './DatePicker.scss'; | ||
| import { FocusTrapZone } from '../../FocusTrapZone'; | ||
| const styles: any = stylesImport; |
There was a problem hiding this comment.
styles should no longer be used anywhere and removed
| return { | ||
| root: [ | ||
| 'ms-DatePicker', | ||
| root: [classNames.root, isDatePickerShown && 'is-open', normalize, {}, className], |
There was a problem hiding this comment.
Shouldn't need the empty object here
cliffkoh
left a comment
There was a problem hiding this comment.
Could you please rename DatePicker.tsx to DatePicker.ts (it has no JSX in it)?
| export const getStyles = (props: IDatePickerStyleProps): IDatePickerStyles => { | ||
| const { className } = props; | ||
| const GlobalClassNames = { | ||
| root: 'ms-DatePicker', |
* master: (151 commits) Css updates for card components (microsoft#5393) DatePicker MergeStyles step 2 - Converts scss to js styles (microsoft#5362) Update stale with 60 day comment and updated ignored label names. (microsoft#5388) replaced await for ie compat syntax - but still needs promise (microsoft#5387) Slider - mergestyle conversion (microsoft#5379) Applying package updates. Enabling publishing for charting and gridlayout. (microsoft#5378) TilesList: fadeOut overlay. (microsoft#5381) Pivot: JS Styling (microsoft#5324) ShimmeredDetailsList: wrapper for DetailsList with Shimmer. (microsoft#5374) dashboard-grid-layout improved example (microsoft#5373) Applying package updates. Addressing Issue microsoft#5165 - Using Customizer with Nav Component (microsoft#5361) Applying package updates. Address issue microsoft#5353 (microsoft#5359) Change log to trigger release (microsoft#5358) Fluent updates (microsoft#5357) TextField render value undefined as empty string (microsoft#5349) Applying package updates. DetailsColumn: css class changes to show gripper when hover on draggable columns (microsoft#5309) ...
Pull request checklist
$ npm run changeDescription of changes
Updates to DatePicker.base.tsx
Removes DatePicker.scss file
Updates to DatePicker.styles.ts
Updates to DatePicker.tsx
Updates t DatePicker.types.ts
Updates snapshots
Microsoft Reviewers: Open in CodeFlow